<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');
            $table->string('goods_name', 50)->comment('商品名称');
            $table->decimal('goods_price', 5,2)->comment('商品价格');
            $table->string('goods_img', 150)->comment('商品图片');
            $table->integer('goods_stock')->comment('商品库存');
            $table->tinyInteger('is_sale')->default(1)->comment('是否上架，0：不上架 1：上架');
            $table->tinyInteger('is_best')->default(0)->comment('是否精品，0：否 1：是');
            $table->tinyInteger('is_hot')->default(0)->comment('是否热销，0：否 1：是');
            $table->tinyInteger('is_new')->default(1)->comment('是否新品，0：否 1：是');
            $table->integer('cate_id')->comment('所属类别');
            $table->integer('brand_id')->comment('品牌id');
            $table->text('goods_desc')->comment('商品描述');
            $table->integer('sale_num')->default(0)->comment('销售量');
            $table->integer('visit_num')->default(0)->comment('访问量');
            $table->integer('appraise_num')->default(0)->comment('评价量');
            $table->string('goods_color')->comment('商品颜色');
            $table->string('goods_size')->comment('商品尺码');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('goods');
    }
}
